@extends('layouts.header')
@section('content')
    <h2 style="text-align: center;padding:50px;">New Post</h2>
    <!-- Show any validation errors, in case they exist; for example a record title that already exists -->
    @if ($errors->any())
        <div class="alert alert-danger">
            <ul>
                @foreach ($errors->all() as $error)
                    <li style="color: red;">{{ $error }}</li>
                @endforeach
            </ul>
        </div>
        @endif
    <!-- Forms for new subtopic -->
    <form action="{{ route('store_new_post') }}" method="POST" style="text-align: center;">
        {{ csrf_field() }}

        <div class="form-group">
            <label for="title">Title: </label><input type="text" style="width: 1218px;" name="title" class="input" value="{{ old('title')}}" /><br /><br />
        </div>

        <div class="form-group">
            <label for="content">Content: </label><textarea rows="8" style="width: 1218px;" name="content" class="input" >{{ old('content')}}</textarea> <br /><br />
        </div>
        <div class="form-group">
            <input type="hidden" name="sub" value="{{ $sub }}">
            <button type="submit" class='btn btn-primary'>Publish</button>
        </div>

    </form>
@endsection()
